package lee.vioson.ebook.utils

/**
 *Author:viosonlee
 *Date:2023/6/16
 *DESCRIPTION:
 */
//convert-an-integer-to-its-ordinal-name
val Int.ordinal: String
    get() = with(arrayOf("th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th")) {
        when (this@ordinal % 100) {
            11, 12, 13 -> this@ordinal.toString() + "th"
            else -> this@ordinal.toString() + this[this@ordinal % 100]
        }
    }